<template>
  <div class="box">
    <p-modal
      title="联系人"
      :visible="visible"
      :confirm-loading="confirmLoading"
      width = "70%"
      @ok="handleOk"
      @cancel="handleCancel"
    >

    <RenderTable 
      :superQueryFieldList="superQueryFieldList" 
      :queryParamArr = "queryParamArr"
      :defColumns="defColumns"
      :url = "url"
      :rowSelectionType = "'radio'"
      :isShowRowSelection = 'true'
      :isShowToolBar = 'false'
      @onSelectChange = 'onSelectChange'      
      @handleEdit = "handleEdit"
      ref='renderTable'
    >
    

    </RenderTable>
  </p-modal>

  </div>
</template>

<script type="text/javascript">
import RenderTable from '@/components/renderTable'
import { timestampToDatetime } from "@/utils/util";

const superQueryFieldList =
[

]
export default {
  data() {
    return {
      superQueryFieldList,
      visible: false,

      queryParamArr: [
        {
          label: "员工号",
          placeholder: "请输入员工号",
          type: 'input',
          key: 'empNumber',
          value: ''
        },
        {
          label: "姓名",
          placeholder: "请输入姓名",
          type: 'input',
          key: 'name',
          value: ''
        },
        {
          label: "部门名称",
          placeholder: "请输入部门名称",
          type: 'input',
          key: 'departmentName',
          value: ''
        },
      ],
      defColumns: [
        {
          title: "序号",
          dataIndex: "",
          key: "rowIndex",
          width: 60,
          align: "center",
          customRender: (t, r, index) => {
            return parseInt(index) + 1;
          },
        },

        {
          title: "员工号",
          align: "center",
          dataIndex: "empNumber",
        },
        {
          title: "姓名",
          align: "center",
          dataIndex: "name",
        },
        {
          title: "部门名称",
          align: "center",
          dataIndex: "departmentName",
        },
        {
          title: "联系电话",
          align: "center",
          dataIndex: "mobile",
        },
      ],
      url: {
        list: '/poros-permission/secStaff/list',
      },
      selectedId: '',
      selectInfo: "",
      layout: {
        labelCol: { span: 4 },
        wrapperCol: { span: 14 },
      },         
    }
  },
  mounted() {
  }, 
  methods: {


    handleEdit(record){
      this.$refs.lineSkillModal.showModal(record)
    },

    showModal(){
      this.visible = true
    },

    // 选择table
    onSelectChange(selectionRows){
      console.log(selectionRows);
      this.selectInfo = selectionRows[0]
      this.selectedId = selectionRows[0].id
    },


    handleOk(e) {
      this.visible = false
      this.$emit('handleSuccess', this.selectInfo)
    },
    handleCancel(e) {
      this.visible = false

    },

  },
  components: {
    RenderTable,
  }
}
</script>

<style lang="less" scoped>
</style>

